package test01;

public class Price {
    public static void main(String[] args) {
        double money = 2.0;
        double cost = 1.1;
        double change = money - cost;
        String result = String.format("%.1f", change);
        System.out.println("找零为："+result);
//        DecimalFormat df = new DecimalFormat("#.0");
//        System.out.println("找零：" + df.format(change));
        //System.out.println("找零为："+change);
        //上面的方法得不到0.9

    }
}
